import Router from 'vue-router'
import Vue from 'vue'

import Login from './views/Login.vue'
import NotFound from './views/404.vue'
import Home from './views/Home.vue'
import Main from './views/Main.vue'
import Menu from './views/permission/Menus'
import Roles from './views/permission/Roles'
import Admin from './views/permission/Admin'
import List from './views/goods/List.vue'
import GoodsSpec from './views/goods/Spec'
import Users from './views/users/List.vue'
import Banners from './views/banner/List.vue'
import Category from './views/category/List'
import Specification from './views/specification/List'
import Recommend from './views/recommend/List'
import Orders from  './views/order/List'
import Express from  './views/express/List'
let routes = [
    {
        path: '/login',
        component: Login,
        name: '',
        hidden: true
    },
    {
        path: '/404',
        component: NotFound,
        name: '',
        hidden: true
    },
    //{ path: '/main', component: Main },
    {
        path: '/',
        component: Home,
        name: '系统设置',
        iconCls: 'fa fa-tv',  //图标样式class
        children: [
            { path: '/main', component: Main, name: '主页' },
            { path: '/banners', component: Banners, name: '公告管理' },
            { path: '/recommend', component: Recommend, name: '首页推荐'},
            { path: '/express', component: Express, name: '快递管理'}
        ]
    },
    {
        path: '/',
        component: Home,
        name: '权限管理',
        iconCls: 'fa fa-key',
        children: [
            { path: '/menus', component: Menu, name: '菜单管理' },
            { path: '/roles', component: Roles, name: '角色管理' },
            { path: '/admins', component: Admin, name: '管理员列表'}
        ]
    },
    {
        path: '/',
        component: Home,
        name: '用户管理',
        iconCls: 'fa fa-users',
        leaf: false,//只有一个节点
        children: [
            { path: '/users', component: Users, name: '用户列表' }
        ]
    },

    {
        path: '/',
        component: Home,
        name: '商品管理',
        iconCls: 'fa fa-shopping-bag',
        children: [
            { path: '/category', component: Category, name: '分类管理' },
            { path: '/goods', component: List, name: '商品管理' },
            { path: '/goods/spec', component: GoodsSpec, name: '商品规格',hidden:true },
            { path: '/specification', component: Specification, name: '规格管理' }
        ]
    },
    {
        path: '/',
        component: Home,
        name: '交易管理',
        iconCls: 'fa fa-shopping-cart',
        children: [
            { path: '/orders', component: Orders, name: '订单管理' },
            { path: '/finance', component: List, name: '财务统计' }
        ]
    },
    {
        path:'/',
        component: Home,
        name: '导航管理',
        iconCls: 'fa fa-navicon'
    },
    {
        path: '*',
        hidden: true,
        redirect: { path: '/404' }
    }
];

Vue.use(Router)
export default new Router({
    routes
})
